#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using Agresso.Interface.Layer.Domain;

#endregion

namespace Agresso.Interface.Layer.Web
{
    public partial class AdvancedScheduleTaskForm : Form
    {
        ConfigurationSetting m_cs;
        public AdvancedScheduleTaskForm(ConfigurationSetting cs)
        {
            InitializeComponent();
            m_cs = cs;
            dateTimePickerStartDate.Value = Convert.ToDateTime(cs.val_4);
            checkBoxEndDate.Checked = Convert.ToBoolean(cs.val_5);
            dateTimePickerEndDate.Enabled = checkBoxEndDate.Checked;
            dateTimePickerEndDate.Value = Convert.ToDateTime(cs.val_6);
            checkBoxRepeatTask.Checked = Convert.ToBoolean(cs.val_7);
            groupBox1.Enabled = checkBoxRepeatTask.Checked;
            numericUpDownEvery.Value = Convert.ToInt16(cs.val_8);
            numericUpDownDuration.Value = Convert.ToInt16(cs.val_9);
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            m_cs.val_4 = dateTimePickerStartDate.Value.ToString();
            m_cs.val_5 = checkBoxEndDate.Checked.ToString();
            m_cs.val_6 = dateTimePickerEndDate.Value.ToString();
            m_cs.val_7 = checkBoxRepeatTask.Checked.ToString();
            m_cs.val_8 = numericUpDownEvery.Value.ToString();
            m_cs.val_9 = numericUpDownDuration.Value.ToString();
            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void checkBoxEndDate_CheckedChanged(object sender, EventArgs e)
        {
            dateTimePickerEndDate.Enabled = checkBoxEndDate.Checked;
        }

        private void checkBoxRepeatTask_CheckedChanged(object sender, EventArgs e)
        {
            groupBox1.Enabled = checkBoxRepeatTask.Checked;
        }
    }
}